<%--
 *  Created by IntelliJ IDEA.
 *  User: Bestick
 *  Date: 2016/4/3
 *  Time: 14:57
 *  Url: http://www.bestick.cn
 *  Copyright © 2015-2016 All rights reserved
 *  -----------------------------------------------------------
 *  会当凌绝顶，一览众山小。
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <!-- Title -->
    <title>登录</title>

    <jsp:include page="${pageContext.request.contextPath}/common/lib/header_lib.jsp"></jsp:include>
</head>
<body>

<div class="login-box">
    <form action="student!login" method="post" onsubmit="return checkForm();">
        <div class="form-box">
            <p>
                <span>准考证号：</span>
                <input type="text" id="id" name="student.id" value="${student.id}"/>
            </p>
            <p>
                <span>登录密码：</span>
                <input type="password" id="password" name="student.password" value="${student.password}"/>
            </p>
            <p>
                <input type="submit" class="btn btn-danger" value="登录"/>
                <input type="button" onclick="resetForm();" class="btn btn-danger" value="重置"/>
            </p>
        </div>
    </form>
</div>

<jsp:include page="${pageContext.request.contextPath}/common/lib/foot_lib.jsp"></jsp:include>

<script>
    function resetForm() {
        $('#id').val('');
        $('#password').val('');
    }
    function checkForm() {
        var id = $('#id').val();
        var pwd = $('#password').val();
        if (id == null || id == '') {
            alert("用户名不能为空！");
            return false;
        }
        if (pwd == null || pwd == '') {
            alert("密码不能为空！");
            return false;
        }
        return true;
    }
    if ('${error}' != '') {
        alert("准考证或密码错误！");
    }
</script>
</body>
</html>
